/**
 *
 */
package co.fitstart.payment.service;

import co.fitstart.payment.entity.app.App;
import co.fitstart.payment.entity.channel.Channel;
import co.fitstart.payment.entity.transaction.OperationType;
import co.fitstart.payment.entity.transaction.TransactionRecord;
import co.fitstart.payment.entity.transaction.TransactionStatus;

/**
 * @author lute
 *
 */
public interface TransactionRecordService {

    /**
     * Create transaction record
     * 
     * @param transactionRecord
     */
    public void createTransactionRecord(TransactionRecord transactionRecord);

    /**
     * Get transaction record according to request number
     * 
     * @param requestNo
     * @return
     */
    public TransactionRecord getTransactionRecord(String requestNo);

    /**
     * Get transaction record with its transaction status is not created by app,
     * channel and order number
     * 
     * @param app
     * @param channel
     * @param orderNo
     * @return
     */
    public TransactionRecord getPaidTransactionRecord(App app, Channel channel, String orderNo);

    /**
     * Change transaction record to transaction status and update trade number
     * 
     * @param transactionRecord
     * @param transactionStatus
     * @param tradeNo
     */
    public void changeTransactionStatus(TransactionRecord transactionRecord, TransactionStatus transactionStatus, String tradeNo);

    /**
     * Change transaction record status
     * 
     * @param transactionRecord
     * @param transactionStatus
     */
    public void changeTransactionStatus(TransactionRecord transactionRecord, TransactionStatus transactionStatus);

    /**
     * Create transaction log
     * 
     * @param transactionRecord
     * @param operationType
     */
    public void createTransactionLog(TransactionRecord transactionRecord, OperationType operationType);

}
